import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

/**
 * 输入相关
 *
 * @author hongchen
 *         create 2017-03-08-21:32
 */
public class TestScanner {
    public static void main(String[] args) {
        for (String arg : args) {
            System.out.println("从命令行接受的参数：" + arg);
        }

/*        Scanner sc = new Scanner(System.in);
        //设置分隔符
        //sc.useDelimiter("\n");
        //sc.hasNextLine  sc.nextLine
        while (sc.hasNext()) {
            System.out.println("键盘输入内容：" + sc.next());
        }*/

        //sc读取文件
        try {
            Scanner scFile = new Scanner(new File("D:\\workspace\\BasicJava\\src\\TestScanner.java "));
            System.out.println("文件内容：");
            while (scFile.hasNextLine()) {
                System.out.println(scFile.nextLine());
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

    }
}
